#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: api_requests.py 
@version:
@time: 2022/05/09 
"""
from TapClientCore.T02_tm_api.v2_api.v2_tm import v2tm as TM


class TMFAPIRequests:

    # POST 新增
    @staticmethod
    def _api_insert(path, data):
        return TM.post_insert_record(path, data)

    # GET 删除
    @staticmethod
    def _api_delete_by_pk_1(path, pk):
        return TM.get_delete_by_id(path, pk)

    # DELETE 删除
    @staticmethod
    def _api_delete_by_pk_2(path, pk):
        return TM.delete_delete_by_id(path, pk)

    # DELETE BY WHERE 删除
    @staticmethod
    def _api_delete_by_where(path, where):
        return TM.delete_delete_by_where(path, where)

    # POST 更新
    @staticmethod
    def _api_update_by_pk_1(path, pk, payload):
        return TM.post_update_by_id(path, pk, payload)

    # PATCH 更新
    @staticmethod
    def _api_update_by_pk_2(path, pk, payload):
        return TM.patch_update_by_id(path, pk, payload)

    # PATCH BY WHERE更新
    @staticmethod
    def _api_update_by_where(path, where, payload):
        return TM.patch_update_by_where(path, where, payload)

    # GET COUNT
    @staticmethod
    def _api_count(path):
        return TM.get_count(path)

    # POST 查询
    @staticmethod
    def _api_query_by_where(path,payload):
        return TM.post_find_by_page(path,payload)

    # GET 查询
    @staticmethod
    def _api_query_by_id(path, pk):
        return TM.get_query_by_id(path, pk)

    # GET BY FILTER 查询
    @staticmethod
    def _api_query_by_filter(path, _filter):
        return TM.get_query_by_page(path, _filter)
